<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Fit Layout</title>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
    <script src="../../../scripts/jquery.min.js"></script>
    <script src="../../../scripts/miniui/miniui.js"></script>
    <link href="../../../scripts/miniui/themes/default/miniui.css" rel="stylesheet">
    <link href="../../../scripts/miniui/themes/icons.css" rel="stylesheet">
    <link href="../../../scripts/miniui/themes/pure/skin.css" rel="stylesheet">
    <script src="../../../scripts/core.js"></script>

</head>
<body>
<style type="text/css">
    html, body {
        margin: 0;
        padding: 0;
        border: 0;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
</style>
<div class="mini-toolbar" style="padding:2px;border-bottom:0;">
    <table style="width:100%;">
        <tr>
            <td style="width:100%;">
                <input class="mini-fileupload" id="fileupload1" limitSize="5000M"
                       name="Fdata"
                       onfileselect="onFileSelect"
                       onuploaderror="onUploadError"
                       onuploadsuccess="onUploadSuccess"/>
                <input class="mini-textbox" id="version"
                       style="width:350px;"
                />
                <a class="mini-button" onclick="startUpload()">开始上传</a>
            </td>

        </tr>
    </table>
</div>
<!--撑满页面-->
<div class="mini-fit">

    <mini-datagrid _dataField="data111" allowCellEdit="true" allowCellSelect="true"
                   allowResize="true" allowSortColumn="false"
                   class="mini-datagrid"
                   id="datagrid1" idField="id" multiSelect="false"
                   pageSize="15" showSortIcon="true"
                   style="width:100%;height:100%;"
                   url="/cmsapi/gm/getUploadFiles">
        <columns>


            <column field="fileVersion" width="100">文件版本号

            </column>
            <column field="uploadTime" headerAlign="center" width="120">上传时间

            </column>
        </columns>
    </mini-datagrid>

</div>

<script type="text/javascript">

    var auth = GetParams()
    mini.parse();
    var grid = mini.get("datagrid1");
    grid.setAjaxOptions({
        headers: {"userId": auth.userId, "token": auth.token}
    });
    grid.load();

    function onUploadSuccess(e) {
        grid.load();
        mini.alert("前端代码上传成功");
    }

    function onUploadError(e) {
        grid.load();
        mini.alert("前端代码上传失败");
    }

    function startUpload() {
        var version = mini.get("version");
        var fileupload = mini.get("fileupload1");
        fileupload.setUploadUrl("/cmsapi/gm/uploadGame" + "/" + auth.userId + "/" + auth.token + "/" + version.getValue());
        fileupload.startUpload();

    }

</script>

</body>
</html>